using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using RideMe.Core;

namespace RideMe.Presentation
{
    public partial class AddNewItemDialog : DialogBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="T:AddNewItemDialog"/> class.
        /// </summary>
        public AddNewItemDialog()
        {
            InitializeComponent();
        }

        private string _folderName;

        /// <summary>
        /// Gets or sets the name of the folder.
        /// </summary>
        /// <value>The name of the folder.</value>
        public string FolderName
        {
            get { return _folderName; }
            set 
            {
                _folderName = value;
                this.Text += string.Format(" - {0}", _folderName);
            }
        }

        /// <summary>
        /// Gets or sets the dialog caption.
        /// </summary>
        /// <value>The dialog caption.</value>
        public string DialogCaption
        {
            get { return this.Text; }
            set { this.Text = value; }
        }

        /// <summary>
        /// Gets or sets the name of the file.
        /// </summary>
        /// <value>The name of the file.</value>
        public string FileName
        {
            get { return itemNameTextBox.Text; }
            set {  itemNameTextBox.Text = value; }
        }

        /// <summary>
        /// Handles the Click event of the okButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void okButton_Click(object sender, EventArgs e)
        {
            if ((itemNameTextBox.Text != null) && (itemNameTextBox.Text.Trim().Length > 0))
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }

        private void itemNameTextBox_Enter(object sender, EventArgs e)
        {
            // We don't want to auto select.
            itemNameTextBox.SelectionStart = 0;
            itemNameTextBox.SelectionLength = 0;
        }
	
	
    }
}

